package com.itheima.Thread.runnable接口;

public class Demo {
    public static void main(String[] args) {
        MyRunnable mr = new MyRunnable();

        Thread t1 = new Thread(mr);
        t1.setName("A");
        t1.start();

        Thread t2 = new Thread(mr);
        t2.setName("B");
        t2.start();
    }
}
//线程任务类
class MyRunnable implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i <20; i++) {
            System.out.println(Thread.currentThread().getName()+ "跑到"+i);
        }
    }
}